package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "Work_", schema = "CRM", catalog = "")
public class Work {
    private long workId;
    private String workTitle;
    private String workType;
    private String workName;
    private String workContent;
    private String workCondition;
    private Date workTime;
    private String workComment;
    private Employee employeeByYgId;

    @Id
    @Column(name = "Work_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getWorkId() {
        return workId;
    }

    public void setWorkId(long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "Work_title")
    public String getWorkTitle() {
        return workTitle;
    }

    public void setWorkTitle(String workTitle) {
        this.workTitle = workTitle;
    }

    @Basic
    @Column(name = "Work_comment")
    public String getWorkComment() {
        return workComment;
    }

    public void setWorkComment(String workComment) {
        this.workComment = workComment;
    }

    @Basic
    @Column(name = "Work_type")
    public String getWorkType() {
        return workType;
    }

    public void setWorkType(String workType) {
        this.workType = workType;
    }

    @Basic
    @Column(name = "Work_name")
    public String getWorkName() {
        return workName;
    }

    public void setWorkName(String workName) {
        this.workName = workName;
    }
    @Basic
    @Column(name = "Work_content")
    public String getWorkContent() {
        return workContent;
    }

    public void setWorkContent(String workContent) {
        this.workContent = workContent;
    }

    @Basic
    @Column(name = "Work_condition")
    public String getWorkCondition() {
        return workCondition;
    }

    public void setWorkCondition(String workCondition) {
        this.workCondition = workCondition;
    }

    @Basic
    @Column(name = "work_time")
    public Date getWorkTime() {
        return workTime;
    }

    public void setWorkTime(Date workTime) {
        this.workTime = workTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Work work = (Work) o;
        return workId == work.workId &&
                Objects.equals(workTitle, work.workTitle) &&
                Objects.equals(workType, work.workType) &&
                Objects.equals(workContent, work.workContent) &&
                Objects.equals(workCondition, work.workCondition) &&
                Objects.equals(workTime, work.workTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(workId, workTitle, workType, workContent, workCondition, workTime);
    }

    @ManyToOne
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployeeByYgId() {
        return employeeByYgId;
    }

    public void setEmployeeByYgId(Employee employeeByYgId) {
        this.employeeByYgId = employeeByYgId;
    }
}
